const twoSum = function (nums, target) {
  let retN = -1;
  let retM = -1;
  for (let n = 0; n < nums.length; n++) {
    const temp = nums[n];
    const findIndex = nums.slice(n + 1).findIndex((ele) => {
      return ele + temp === target;
    });
    if (findIndex > -1) {
      retN = n;
      retM = findIndex + n + 1;
      break;
    }
  }
  return [retN, retM];
};

const ret = twoSum([2, 3, 4, 5], 7);

console.log(ret);
